<template>
  <div id="setup">
    <van-nav-bar title="设置" left-arrow @click-left="onClickLeft" />
    <main class="setcontent">
      <div class="change-password">
        <van-cell is-link value="修改密码" />
        <van-cell is-link value="注册账号" />
        <van-cell title="检查新版本" is-link />
        <van-cell center title="精准推荐">
          <template #right-icon>
            <van-switch v-model="checked" />
          </template>
        </van-cell>
      </div>
      <div class="feedback">
        <van-cell is-link value="修改密码" />
        <van-cell is-link value="关于" />
      </div>
      <div class="drop-out">
        <van-button round size="large" text="退出登录" @click="handleclick" />
      </div>
    </main>
  </div>
</template>
<script>
import { ref } from "vue";
import { useRouter } from "vue-router";
export default {
  setup() {
    const onClickLeft = () => {
      router.go(-1);
    };
    const router = useRouter();
    const checked = ref(true);
    const handleclick = () => {
      if (sessionStorage.getItem("token")) {
        sessionStorage.removeItem("token");
        router.go(-1);
      }
    };
    return {
      onClickLeft,
      checked,
      handleclick,
      router,
    };
  },
};
</script>
<style lang="less" scoped>
#setup {
  .setcontent {
    width: 100%;
    height: 100%;
    padding: 10px 0;
    background: rgb(244, 247, 249);
    .change-password {
      margin-bottom: 10px;
    }
    .drop-out {
      width: 100%;
      margin-top: 270px;
      .van-button__text {
        color: red;
      }
    }
  }
}
</style>
